<%--
  Created by IntelliJ IDEA.
  User: HP
  Date: 2021/5/20
  Time: 19:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fm" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>Title</title>
    <script type="text/javascript" src="/js/jquery-3.4.1.min.js"></script>
    <script type="text/javascript" src="/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/bootstrap.min.css">
</head>
<body>
<div class="container">
    <div class="row">
        <a href="/addEmp.jsp" class="btn btn-primary btn-success" role="button">新增</a>
        <table class="table table-hover table-bordered table-striped">
            <tr>
                <td>员工编号</td>
                <td>员工姓名</td>
                <td>员工性别</td>
                <td>员工工资</td>
                <td>员工密码</td>
                <td>员工部门名</td>
                <td>员工出生日期</td>
                <td>操作</td>
            </tr>
            <c:forEach items="${empList.list}" var="e">

                <tr>
                    <td>${e.eno}</td>
                    <td>${e.ename}</td>
                    <td>${e.esex}</td>
                    <td>${e.salary}</td>
                    <td>${e.pwd}</td>
                    <td>${e.dept.dname}</td>
                    <td><fm:formatDate value="${e.bornDate}" pattern="yyyy-MM-dd"></fm:formatDate></td>
                    <td>
                        <a href="/emp/getEmpByEno/${e.eno}" class="btn btn-primary btn-danger">修改</a>
                        <a href="/emp/delEmp/${e.eno}" class="btn btn-primary btn-danger">删除 </a>
                    </td>
                </tr>
            </c:forEach>
        </table>

        <div class="text-center">
            <nav aria-label="Page navigation">
                <ul class="pagination">
                    <li>
                        <a href="${pageContext.request.contextPath}/emp/getByPage?pageNum=1">首页</a>
                    </li>
                    <li>
                        <a href="${pageContext.request.contextPath}/emp/getByPage?pageNum=${empList.prePage}" aria-label="Previous">
                            <span aria-hidden="true">&laquo;</span>
                        </a>
                    </li>
                    <li>
                        <a href="${pageContext.request.contextPath}/emp/getByPage?pageNum=${empList.nextPage}" aria-label="Next">
                            <span aria-hidden="true">&raquo;</span>
                        </a>
                    </li>
                    <li>
                        <a href="${pageContext.request.contextPath}/emp/getByPage?pageNum=${empList.pages}">尾页</a>
                    </li>
                </ul>
            </nav>
        </div>
    </div>
</div>
</body>
</html>
